﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
    <meta http-equiv="expires" content="0" />
    <title>FaceCat</title>
</head>
<body>
    <canvas id="mycanvas" width="1000" height="700" style="position: fixed; left: 0px; top: 0px;"/>
    <script type="text/javascript" src="facecat.js"></script>
    <script type="text/javascript">
        let canvas = document.getElementById("mycanvas"); //绘图区域
        let gPaint = new FCPaint(); //绘图对象
        gPaint.canvas = canvas;
        scaleCanvas(gPaint);
        //判断是否移动端
        gPaint.isMobile = isMobileMode();
        if (gPaint.isMobile) {
            gPaint.scaleFactorX = 2.5;
            gPaint.scaleFactorY = 2.5;
        }
        addDefaultEvent(canvas, gPaint);
        //我的视图
        class MyView extends FCView {
            constructor()
            {
                super();
            }
        };

        let myview = new MyView(); //我的视图
        addView(myview, gPaint); //添加到框架中
        myview.location = new FCPoint(100, 100); //设置位置
        myview.size = new FCSize(200, 200); //设置大小
        myview.backColor = "rgb(255,0,0)"; //背景色
        myview.borderColor = "rgb(0,0,0)"; //边线颜色
        /*
         * 重置大小
         */
        let resizeAll = function () {
            canvas.width = document.documentElement.clientWidth;
            canvas.height = document.documentElement.clientHeight;
            scaleCanvas(gPaint);
            //刷新视图
            invalidate(gPaint);
        };

        /*
        * 监听大小改变
        */
        window.onresize = function () {
            resizeAll();
        };

        /*
        * 旋转监听
        */
        window.onorientationchange = function () {
            resizeAll();

        };
        invalidate(gPaint);
    </script>
</body>
</html>
